/**
 * Created by IntelliJ IDEA
 *
 * @author zhengjie
 * @Date:2022/2/14 15:03
 * @Version 1.0
 */
package com.zj.ssm.service.impl;

import com.zj.ssm.mapper.RecordMapper;
import com.zj.ssm.pojo.domain.LogData;
import com.zj.ssm.pojo.domain.query.RecordQuery;
import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class RecordServiceImpl implements RecordService {

    @Autowired
    public RecordMapper recordMapper;

    @Override
    public AjaxResult query(RecordQuery query) {
        List<LogData> logDatas = recordMapper.querylog(query);
        Long aLong = recordMapper.queryTotal(query);
        HashMap<Object,Object> objectObjectHashMap = new HashMap<Object,Object>();
        objectObjectHashMap.put("currentData",logDatas);
        objectObjectHashMap.put("totalCount",aLong);

        return AjaxResult.success(objectObjectHashMap);
    }

    @Override
    public AjaxResult querydata(Integer id) {
        LogData data=recordMapper.querydata(id);
        return AjaxResult.success(data);
    }


}
